<?php

if($_POST['xmlhttp']){
	include_once('config.php');
	include_once(mnminclude.'KMessaging.php');

	$message =  new KMessaging();
	$message->tblName = table_messages;
	$title = $_POST['ownernames'] . '向您发出了认领请求';
	$body = '<a href="user.php?uid=' . $_POST['ownerid'] . '" target="_blank">' . $_POST['ownernames'] . '</a>向您发出了认领请求，希望您将其设置为您推荐的物<a href="story.php?id=' . $_POST['linkid'] . '" target="_blank">' . $_POST['thingtitle'] . '</a>的所有者，您可<a href="javascript:" onclick="accept_owner_request(' . $_POST['linkid'] . ','. $_POST['ownerid'] . ')">接受</a>或者<a href="javascript:" onclick="deny_owner_request(' . $_POST['linkid'] . ','. $_POST['ownerid'] . ')">拒绝</a>此认领请求';
	$sender = 1;
	$receiver = $_POST['submitterid'];
	$senderlevel = 0;
	$sendmsg = $message->SendMessege($title,$body,$sender,$receiver,$senderlevel);
	switch ($sendmsg) {
		case 0:
			echo "success";
			die();
			break;
		case 2:
			echo "nobody";
			die();
			break;
		case 1:
			echo "notitle";
			die();
			break;
		case 6:
			echo "database_error";
			die();
			break;
		default:
			echo "fail";
			die();
			break;
	}
}
?>